package cn.iocoder.yudao.module.reservation.dal.mysql.member;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.reservation.dal.dataobject.member.MemberDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.reservation.controller.admin.member.vo.*;

/**
 * 会员 Mapper
 *
 * @author yy
 */
@Mapper
public interface MemberMapper extends BaseMapperX<MemberDO> {

    default PageResult<MemberDO> selectPage(MemberPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MemberDO>()
                .eqIfPresent(MemberDO::getCode, reqVO.getCode())
                .likeIfPresent(MemberDO::getUserName, reqVO.getUserName())
                .eqIfPresent(MemberDO::getPassword, reqVO.getPassword())
                .likeIfPresent(MemberDO::getNickName, reqVO.getNickName())
                .eqIfPresent(MemberDO::getGender, reqVO.getGender())
                .eqIfPresent(MemberDO::getBirthday, reqVO.getBirthday())
                .eqIfPresent(MemberDO::getIdNumber, reqVO.getIdNumber())
                .eqIfPresent(MemberDO::getPhone, reqVO.getPhone())
                .eqIfPresent(MemberDO::getEmail, reqVO.getEmail())
                .betweenIfPresent(MemberDO::getRegisterDate, reqVO.getRegisterDate())
                .eqIfPresent(MemberDO::getStatus, reqVO.getStatus())
                .orderByDesc(MemberDO::getId));
    }

}